/*
 * $RCSfile: Dialect.java,v $
 * $Revision: 1.1 $
 * $Date: 2009-03-01 $
 *
 * Copyright (C) 2008 Skin, Inc. All rights reserved.
 *
 * This software is the proprietary information of Skin, Inc.
 * Use is subject to license terms.
 */
package com.skin.webcat.database.dialect;

import java.sql.Connection;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
import java.util.List;

import com.skin.webcat.database.Column;
import com.skin.webcat.database.Table;

/**
 * <p>Title: Dialect</p>
 * <p>Description: </p>
 * <p>Copyright: Copyright (c) 2006</p>
 * @author xuesong.net
 * @version 1.0
 */
public interface Dialect {
    /**
     * @return Connection
     */
    Connection getConnection();

    /**
     * @param connection
     */
    void setConnection(Connection connection);

    /**
     * @return String
     */
    String getName();

    /**
     * @param connection
     * @return List<String>
     * @throws SQLException
     */
    List<String> getDatabaseList(Connection connection) throws SQLException;

    /**
     * @param catalog
     * @param schema
     * @param pattern
     * @param types
     * @param flag
     * @return List<Table>
     * @throws SQLException
     */
    List<Table> getTableList(String catalog, String schema, String pattern, String[] types, boolean flag) throws SQLException;

    /**
     * @param tableName
     * @return Table
     * @throws SQLException
     */
    Table getTable(String tableName) throws SQLException;

    /**
     * @param catalog
     * @param schema
     * @param tableName
     * @param types
     * @return Table
     * @throws SQLException
     */
    Table getTable(String catalog, String schema, String tableName) throws SQLException;

    /**
     * @param catalog
     * @param schema
     * @param tableName
     * @param types
     * @return Table
     * @throws SQLException
     */
    Table getTable(String catalog, String schema, String tableName, String[] types) throws SQLException;

    /**
     * @param metaData
     * @return Table
     * @throws SQLException
     */
    Table getTable(ResultSetMetaData metaData) throws SQLException;

    /**
     * @param column
     */
    void process(Column column);

    /**
     * @param column
     * @return String
     */
    String convert(Column column);

    /**
     * @param tableName
     * @return String
     */
    String getTableName(String tableName);

    /**
     * @param columnName
     * @return String
     */
    String getColumnName(String columnName);

    /**
     * @param source
     * @return String
     */
    String escape(String source);
}
